<!--  -->
<template>
  <div>
    <FaqModalBox></FaqModalBox>

    <el-form :inline="true" :model="form" class="demo-form-inline">
      <el-form-item>
        <el-input v-model="form.user" placeholder="请输入问答关键词"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="faqSelect" icon="el-icon-search"
          >查询</el-button
        >
      </el-form-item>
      <el-form-item>
        <el-button
          @click="initialization('get', '/question/list')"
          icon="el-icon-refresh"
          >重置</el-button
        >
      </el-form-item>
    </el-form>
    <template>
      <el-table :data="faqData.faqTableData" style="width: 100%">
        <el-table-column fixed prop="id" label="问题编号" width="120">
        </el-table-column>
        <el-table-column prop="title" label="问题标题" width="300">
        </el-table-column>
        <el-table-column prop="publisher" label="发布者" width="120">
        </el-table-column>
        <el-table-column prop="readNum" label="阅读量" width="120">
        </el-table-column>
        <el-table-column prop="responseNum" label="回复量" width="120">
        </el-table-column>
        <el-table-column prop="publishDate" label="发布时间" width="300">
        </el-table-column>
        <el-table-column fixed="right" label="操作" width="250">
          <template slot-scope="scope">
            <el-button @click="handleClick(scope.row)" type="text" size="small"
              >查看详情</el-button
            >
            <el-button
              type="text"
              size="small"
              @click="open(scope.row)"
              style="color: #fb9678"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </template>
    <div class="block">
      <el-pagination
        background
        @current-change="handleCurrentChange"
        :current-page="currentPage4"
        :page-size="pageSize"
        layout="prev, pager, next"
        :total="allPage"
      >
      </el-pagination>
    </div>
  </div>
</template>
<script >
import FaqModalBox from "../../components/chenlin/faq/FaqModalBox.vue";
import { mapGetters, mapActions } from "vuex";
export default {
  name: "Faq",
  data() {
    return {
      form: {
        user: "",
        region: "",
      },
      TableData: [], //获取请求返回来的值并存储到vuex
      faqDetail: [], //产看详情的内容
      /**时间戳 */
      date: "",
      Y: 0,
      M: 0,
      D: 0,
      h: 0,
      m: 0,
      s: 0,
      /**页码 */
      pageSizes: [5, 10, 50, 100],
      pageSize: 5,
      allPage: 0,
      currentPage1: 5,
      currentPage2: 5,
      currentPage3: 5,
      currentPage4: 1,
    };
  },
  computed: {
    ...mapGetters(["faqData"]),
  },
  props: [],
  components: {
    FaqModalBox,
  },
  created() {},
  mounted() {
    this.$axios({
      method: "get",
      url: "/question/list",
      // headers:{
      //   token:'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwaG9uZSI6IjEzMjU4MjkwMDAwIiwibmFtZSI6IueuoeeQhuWRmCIsImlkZW50aXR5Q2FyZCI6IjUxMDkwMjE5OTkwNDMwODg4OCIsImV4cCI6MTY1ODgzODE0NCwidXNlcm5hbWUiOiJhZG1pbjExIiwicGVybWlzc2lvblRhZ3MiOiJiaWxsTWFuYWdlcjpsaXN0YmlsbE1hbmFnZXI6ZmluZEFsbGJpbGxNYW5hZ2VyOmZpbmRiaWxsTWFuYWdlcjppbnNlcnRiaWxsTWFuYWdlcjp1cGRhdGViaWxsTWFuYWdlcjpkZWxldGVob3VzZUluZm86bGlzdGhvdXNlSW5mbzp1cGRhdGVob3VzZUluZm86aW5zZXJ0aG91c2VJbmZvOmRlbGV0ZWhvdXNlSW5mbzpmaW5kRGV0YWlsY29udHJhY3RNYW5hZ2VyOmxpc3Rjb250cmFjdE1hbmFnZXI6ZmluZEFsbGNvbnRyYWN0TWFuYWdlcjpmaW5kY29udHJhY3RNYW5hZ2VyOmluc2VydGNvbnRyYWN0TWFuYWdlcjp1cGRhdGVjb250cmFjdE1hbmFnZXI6ZGVsZXRld2l0aGRyYXdSZXZpZXc6bGlzdHdpdGhkcmF3UmV2aWV3OmZpbmRBbGx3aXRoZHJhd1JldmlldzpmaW5kd2l0aGRyYXdSZXZpZXc6aW5zZXJ0d2l0aGRyYXdSZXZpZXc6dXBkYXRlcXVlc3Rpb246bGlzdHdpdGhkcmF3UmV2aWV3OmRlbGV0ZXF1ZXN0aW9uOmZpbmRBbGxxdWVzdGlvbjpkZWxldGVtZXNzYWdlTGlzdDpsaXN0bWVzc2FnZUxpc3Q6ZmluZEFsbG1lc3NhZ2VMaXN0Omluc2VydG1lc3NhZ2VMaXN0OmRlbGV0ZXVzZXI6ZmluZHVzZXI6bGlzdHVzZXI6ZmluZERldGFpbHNCeUlkbGFuZGxvcmQ6bGlzdGxhbmRsb3JkOmZpbmRIb3VzZUluZm9CeUxhbmRsb3JkSWRsYW5kbG9yZDpmaW5kaG91c2VSZW50UmVxdWVzdDpsaXN0aG91c2VSZW50UmVxdWVzdDpmaW5kRGV0YWlsQnlJZGhvdXNlUmVudFJlcXVlc3Q6ZGVsZXRlZmFjaWxpdHk6bGlzdGZhY2lsaXR5OmZpbmRBbGxmYWNpbGl0eTppbnNlcnRmYWNpbGl0eTpkZWxldGVjb25maWd1cmF0aW9uOmZpbmRBbGxQYXltZW50Y29uZmlndXJhdGlvbjpmaW5kQWxsTGVhc2Vjb25maWd1cmF0aW9uOmZpbmRBbGxUb3dhcmRjb25maWd1cmF0aW9uOmZpbmRBbGxEZWNvcmF0ZWNvbnRyYWN0VGVtcGxhdGU6bGlzdGNvbnRyYWN0VGVtcGxhdGU6ZmluZEFsbGNvbnRyYWN0VGVtcGxhdGU6aW5zZXJ0Y29udHJhY3RUZW1wbGF0ZTpkZWxldGVjb250cmFjdFRlbXBsYXRlOmRlbGV0ZWNvbnRyYWN0VGVtcGxhdGU6ZmluZEJ5SWRob3VzZVJlcXVlc3Q6bGlzdGhvdXNlUmVxdWVzdDpkZWxldGUifQ.92u_QajKKM4EDeK-7bA2lTFR_9NhAcrgzm-AF1n-JX4'
      // },
      params: {
        // 'page':1,
        // 'limit':5
      },
    }).then((res) => {
      this.TableData = res.data;
      this.allPage = res.data.length;
      this.TableData.length = 5;

      /**时间戳转换 */
      for (let i = 0; i < this.TableData.length; i++) {
        this.date = new Date(this.TableData[i].publishDate);
        this.Y = this.date.getFullYear() + "-";
        this.M =
          (this.date.getMonth() + 1 < 10
            ? "0" + (this.date.getMonth() + 1)
            : this.date.getMonth() + 1) + "-";
        this.D = this.date.getDate() + " ";
        this.h = this.date.getHours() + ":";
        this.m = this.date.getMinutes() + ":";
        this.s = this.date.getSeconds();
        this.TableData[i].publishDate =
          this.Y + this.M + this.D + this.h + this.m + this.s;
      }

      // console.log(this.TableData);
      this.AFaqTableData(this.TableData);
    });
  },
  methods: {
    ...mapActions(["AFaqModalBox", "AFaqTableData", "AFaqDetail"]),
    /**初始化请求 */
    initialization(me, address) {
      this.$axios({
        method: me,
        url: address,
        // headers:{
        //   token:'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwaG9uZSI6IjEzMjU4MjkwMDAwIiwibmFtZSI6IueuoeeQhuWRmCIsImlkZW50aXR5Q2FyZCI6IjUxMDkwMjE5OTkwNDMwODg4OCIsImV4cCI6MTY1ODgzODE0NCwidXNlcm5hbWUiOiJhZG1pbjExIiwicGVybWlzc2lvblRhZ3MiOiJiaWxsTWFuYWdlcjpsaXN0YmlsbE1hbmFnZXI6ZmluZEFsbGJpbGxNYW5hZ2VyOmZpbmRiaWxsTWFuYWdlcjppbnNlcnRiaWxsTWFuYWdlcjp1cGRhdGViaWxsTWFuYWdlcjpkZWxldGVob3VzZUluZm86bGlzdGhvdXNlSW5mbzp1cGRhdGVob3VzZUluZm86aW5zZXJ0aG91c2VJbmZvOmRlbGV0ZWhvdXNlSW5mbzpmaW5kRGV0YWlsY29udHJhY3RNYW5hZ2VyOmxpc3Rjb250cmFjdE1hbmFnZXI6ZmluZEFsbGNvbnRyYWN0TWFuYWdlcjpmaW5kY29udHJhY3RNYW5hZ2VyOmluc2VydGNvbnRyYWN0TWFuYWdlcjp1cGRhdGVjb250cmFjdE1hbmFnZXI6ZGVsZXRld2l0aGRyYXdSZXZpZXc6bGlzdHdpdGhkcmF3UmV2aWV3OmZpbmRBbGx3aXRoZHJhd1JldmlldzpmaW5kd2l0aGRyYXdSZXZpZXc6aW5zZXJ0d2l0aGRyYXdSZXZpZXc6dXBkYXRlcXVlc3Rpb246bGlzdHdpdGhkcmF3UmV2aWV3OmRlbGV0ZXF1ZXN0aW9uOmZpbmRBbGxxdWVzdGlvbjpkZWxldGVtZXNzYWdlTGlzdDpsaXN0bWVzc2FnZUxpc3Q6ZmluZEFsbG1lc3NhZ2VMaXN0Omluc2VydG1lc3NhZ2VMaXN0OmRlbGV0ZXVzZXI6ZmluZHVzZXI6bGlzdHVzZXI6ZmluZERldGFpbHNCeUlkbGFuZGxvcmQ6bGlzdGxhbmRsb3JkOmZpbmRIb3VzZUluZm9CeUxhbmRsb3JkSWRsYW5kbG9yZDpmaW5kaG91c2VSZW50UmVxdWVzdDpsaXN0aG91c2VSZW50UmVxdWVzdDpmaW5kRGV0YWlsQnlJZGhvdXNlUmVudFJlcXVlc3Q6ZGVsZXRlZmFjaWxpdHk6bGlzdGZhY2lsaXR5OmZpbmRBbGxmYWNpbGl0eTppbnNlcnRmYWNpbGl0eTpkZWxldGVjb25maWd1cmF0aW9uOmZpbmRBbGxQYXltZW50Y29uZmlndXJhdGlvbjpmaW5kQWxsTGVhc2Vjb25maWd1cmF0aW9uOmZpbmRBbGxUb3dhcmRjb25maWd1cmF0aW9uOmZpbmRBbGxEZWNvcmF0ZWNvbnRyYWN0VGVtcGxhdGU6bGlzdGNvbnRyYWN0VGVtcGxhdGU6ZmluZEFsbGNvbnRyYWN0VGVtcGxhdGU6aW5zZXJ0Y29udHJhY3RUZW1wbGF0ZTpkZWxldGVjb250cmFjdFRlbXBsYXRlOmRlbGV0ZWNvbnRyYWN0VGVtcGxhdGU6ZmluZEJ5SWRob3VzZVJlcXVlc3Q6bGlzdGhvdXNlUmVxdWVzdDpkZWxldGUifQ.92u_QajKKM4EDeK-7bA2lTFR_9NhAcrgzm-AF1n-JX4'
        // },
        params: {
          page: 1,
          limit: 5,
        },
      }).then((res) => {
        this.TableData = res.data;
        /**时间戳转换 */
        for (let i = 0; i < this.TableData.length; i++) {
          this.date = new Date(this.TableData[i].publishDate);
          this.Y = this.date.getFullYear() + "-";
          this.M =
            (this.date.getMonth() + 1 < 10
              ? "0" + (this.date.getMonth() + 1)
              : this.date.getMonth() + 1) + "-";
          this.D = this.date.getDate() + " ";
          this.h = this.date.getHours() + ":";
          this.m = this.date.getMinutes() + ":";
          this.s = this.date.getSeconds();
          this.TableData[i].publishDate =
            this.Y + this.M + this.D + this.h + this.m + this.s;
        }
        // console.log(this.TableData);
        this.AFaqTableData(this.TableData);
      });
    },

    faqSelect() {
      this.$axios({
        method: "get",
        url: "/question/list",
        // headers:{
        //   token:'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwaG9uZSI6IjEzMjU4MjkwMDAwIiwibmFtZSI6IueuoeeQhuWRmCIsImlkZW50aXR5Q2FyZCI6IjUxMDkwMjE5OTkwNDMwODg4OCIsImV4cCI6MTY1ODgzODE0NCwidXNlcm5hbWUiOiJhZG1pbjExIiwicGVybWlzc2lvblRhZ3MiOiJiaWxsTWFuYWdlcjpsaXN0YmlsbE1hbmFnZXI6ZmluZEFsbGJpbGxNYW5hZ2VyOmZpbmRiaWxsTWFuYWdlcjppbnNlcnRiaWxsTWFuYWdlcjp1cGRhdGViaWxsTWFuYWdlcjpkZWxldGVob3VzZUluZm86bGlzdGhvdXNlSW5mbzp1cGRhdGVob3VzZUluZm86aW5zZXJ0aG91c2VJbmZvOmRlbGV0ZWhvdXNlSW5mbzpmaW5kRGV0YWlsY29udHJhY3RNYW5hZ2VyOmxpc3Rjb250cmFjdE1hbmFnZXI6ZmluZEFsbGNvbnRyYWN0TWFuYWdlcjpmaW5kY29udHJhY3RNYW5hZ2VyOmluc2VydGNvbnRyYWN0TWFuYWdlcjp1cGRhdGVjb250cmFjdE1hbmFnZXI6ZGVsZXRld2l0aGRyYXdSZXZpZXc6bGlzdHdpdGhkcmF3UmV2aWV3OmZpbmRBbGx3aXRoZHJhd1JldmlldzpmaW5kd2l0aGRyYXdSZXZpZXc6aW5zZXJ0d2l0aGRyYXdSZXZpZXc6dXBkYXRlcXVlc3Rpb246bGlzdHdpdGhkcmF3UmV2aWV3OmRlbGV0ZXF1ZXN0aW9uOmZpbmRBbGxxdWVzdGlvbjpkZWxldGVtZXNzYWdlTGlzdDpsaXN0bWVzc2FnZUxpc3Q6ZmluZEFsbG1lc3NhZ2VMaXN0Omluc2VydG1lc3NhZ2VMaXN0OmRlbGV0ZXVzZXI6ZmluZHVzZXI6bGlzdHVzZXI6ZmluZERldGFpbHNCeUlkbGFuZGxvcmQ6bGlzdGxhbmRsb3JkOmZpbmRIb3VzZUluZm9CeUxhbmRsb3JkSWRsYW5kbG9yZDpmaW5kaG91c2VSZW50UmVxdWVzdDpsaXN0aG91c2VSZW50UmVxdWVzdDpmaW5kRGV0YWlsQnlJZGhvdXNlUmVudFJlcXVlc3Q6ZGVsZXRlZmFjaWxpdHk6bGlzdGZhY2lsaXR5OmZpbmRBbGxmYWNpbGl0eTppbnNlcnRmYWNpbGl0eTpkZWxldGVjb25maWd1cmF0aW9uOmZpbmRBbGxQYXltZW50Y29uZmlndXJhdGlvbjpmaW5kQWxsTGVhc2Vjb25maWd1cmF0aW9uOmZpbmRBbGxUb3dhcmRjb25maWd1cmF0aW9uOmZpbmRBbGxEZWNvcmF0ZWNvbnRyYWN0VGVtcGxhdGU6bGlzdGNvbnRyYWN0VGVtcGxhdGU6ZmluZEFsbGNvbnRyYWN0VGVtcGxhdGU6aW5zZXJ0Y29udHJhY3RUZW1wbGF0ZTpkZWxldGVjb250cmFjdFRlbXBsYXRlOmRlbGV0ZWNvbnRyYWN0VGVtcGxhdGU6ZmluZEJ5SWRob3VzZVJlcXVlc3Q6bGlzdGhvdXNlUmVxdWVzdDpkZWxldGUifQ.92u_QajKKM4EDeK-7bA2lTFR_9NhAcrgzm-AF1n-JX4'
        // },
        params: {
          title: this.form.user,
          page: 1,
          limit: 5,
        },
      }).then((res) => {
        // console.log(this.form.user);
        // console.log('查询结果：'+res);
        this.TableData = res.data;
        /**时间戳转换 */
        for (let i = 0; i < this.TableData.length; i++) {
          this.date = new Date(this.TableData[i].publishDate);
          this.Y = this.date.getFullYear() + "-";
          this.M =
            (this.date.getMonth() + 1 < 10
              ? "0" + (this.date.getMonth() + 1)
              : this.date.getMonth() + 1) + "-";
          this.D = this.date.getDate() + " ";
          this.h = this.date.getHours() + ":";
          this.m = this.date.getMinutes() + ":";
          this.s = this.date.getSeconds();
          this.TableData[i].publishDate =
            this.Y + this.M + this.D + this.h + this.m + this.s;
        }
        // console.log(this.TableData);
        this.AFaqTableData(this.TableData);
      });
    },
    handleClick(row) {
      this.faqDetail = row;
      this.AFaqDetail(this.faqDetail);
      this.AFaqModalBox();
    },
    /**删除确认框 */
    open(row) {
      this.$confirm("您确定删除当前问题, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "删除成功!",
          });

          this.faqDel(row.id);
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    /**删除请求 */
    faqDel(id) {
      this.$axios({
        method: "get",
        url: "/question/delete",
        // headers:{
        //   token:'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwaG9uZSI6IjEzMjU4MjkwMDAwIiwibmFtZSI6IueuoeeQhuWRmCIsImlkZW50aXR5Q2FyZCI6IjUxMDkwMjE5OTkwNDMwODg4OCIsImV4cCI6MTY1ODgzODE0NCwidXNlcm5hbWUiOiJhZG1pbjExIiwicGVybWlzc2lvblRhZ3MiOiJiaWxsTWFuYWdlcjpsaXN0YmlsbE1hbmFnZXI6ZmluZEFsbGJpbGxNYW5hZ2VyOmZpbmRiaWxsTWFuYWdlcjppbnNlcnRiaWxsTWFuYWdlcjp1cGRhdGViaWxsTWFuYWdlcjpkZWxldGVob3VzZUluZm86bGlzdGhvdXNlSW5mbzp1cGRhdGVob3VzZUluZm86aW5zZXJ0aG91c2VJbmZvOmRlbGV0ZWhvdXNlSW5mbzpmaW5kRGV0YWlsY29udHJhY3RNYW5hZ2VyOmxpc3Rjb250cmFjdE1hbmFnZXI6ZmluZEFsbGNvbnRyYWN0TWFuYWdlcjpmaW5kY29udHJhY3RNYW5hZ2VyOmluc2VydGNvbnRyYWN0TWFuYWdlcjp1cGRhdGVjb250cmFjdE1hbmFnZXI6ZGVsZXRld2l0aGRyYXdSZXZpZXc6bGlzdHdpdGhkcmF3UmV2aWV3OmZpbmRBbGx3aXRoZHJhd1JldmlldzpmaW5kd2l0aGRyYXdSZXZpZXc6aW5zZXJ0d2l0aGRyYXdSZXZpZXc6dXBkYXRlcXVlc3Rpb246bGlzdHdpdGhkcmF3UmV2aWV3OmRlbGV0ZXF1ZXN0aW9uOmZpbmRBbGxxdWVzdGlvbjpkZWxldGVtZXNzYWdlTGlzdDpsaXN0bWVzc2FnZUxpc3Q6ZmluZEFsbG1lc3NhZ2VMaXN0Omluc2VydG1lc3NhZ2VMaXN0OmRlbGV0ZXVzZXI6ZmluZHVzZXI6bGlzdHVzZXI6ZmluZERldGFpbHNCeUlkbGFuZGxvcmQ6bGlzdGxhbmRsb3JkOmZpbmRIb3VzZUluZm9CeUxhbmRsb3JkSWRsYW5kbG9yZDpmaW5kaG91c2VSZW50UmVxdWVzdDpsaXN0aG91c2VSZW50UmVxdWVzdDpmaW5kRGV0YWlsQnlJZGhvdXNlUmVudFJlcXVlc3Q6ZGVsZXRlZmFjaWxpdHk6bGlzdGZhY2lsaXR5OmZpbmRBbGxmYWNpbGl0eTppbnNlcnRmYWNpbGl0eTpkZWxldGVjb25maWd1cmF0aW9uOmZpbmRBbGxQYXltZW50Y29uZmlndXJhdGlvbjpmaW5kQWxsTGVhc2Vjb25maWd1cmF0aW9uOmZpbmRBbGxUb3dhcmRjb25maWd1cmF0aW9uOmZpbmRBbGxEZWNvcmF0ZWNvbnRyYWN0VGVtcGxhdGU6bGlzdGNvbnRyYWN0VGVtcGxhdGU6ZmluZEFsbGNvbnRyYWN0VGVtcGxhdGU6aW5zZXJ0Y29udHJhY3RUZW1wbGF0ZTpkZWxldGVjb250cmFjdFRlbXBsYXRlOmRlbGV0ZWNvbnRyYWN0VGVtcGxhdGU6ZmluZEJ5SWRob3VzZVJlcXVlc3Q6bGlzdGhvdXNlUmVxdWVzdDpkZWxldGUifQ.92u_QajKKM4EDeK-7bA2lTFR_9NhAcrgzm-AF1n-JX4'
        // },
        params: {
          id: id,
        },
      }).then((res) => {
        // console.log(res);
        // this.TableData=res.data;
        // this.AFaqTableData(this.TableData);
        this.$axios({
          method: "get",
          url: "/question/list",
          // headers:{
          //   token:'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwaG9uZSI6IjEzMjU4MjkwMDAwIiwibmFtZSI6IueuoeeQhuWRmCIsImlkZW50aXR5Q2FyZCI6IjUxMDkwMjE5OTkwNDMwODg4OCIsImV4cCI6MTY1ODgzODE0NCwidXNlcm5hbWUiOiJhZG1pbjExIiwicGVybWlzc2lvblRhZ3MiOiJiaWxsTWFuYWdlcjpsaXN0YmlsbE1hbmFnZXI6ZmluZEFsbGJpbGxNYW5hZ2VyOmZpbmRiaWxsTWFuYWdlcjppbnNlcnRiaWxsTWFuYWdlcjp1cGRhdGViaWxsTWFuYWdlcjpkZWxldGVob3VzZUluZm86bGlzdGhvdXNlSW5mbzp1cGRhdGVob3VzZUluZm86aW5zZXJ0aG91c2VJbmZvOmRlbGV0ZWhvdXNlSW5mbzpmaW5kRGV0YWlsY29udHJhY3RNYW5hZ2VyOmxpc3Rjb250cmFjdE1hbmFnZXI6ZmluZEFsbGNvbnRyYWN0TWFuYWdlcjpmaW5kY29udHJhY3RNYW5hZ2VyOmluc2VydGNvbnRyYWN0TWFuYWdlcjp1cGRhdGVjb250cmFjdE1hbmFnZXI6ZGVsZXRld2l0aGRyYXdSZXZpZXc6bGlzdHdpdGhkcmF3UmV2aWV3OmZpbmRBbGx3aXRoZHJhd1JldmlldzpmaW5kd2l0aGRyYXdSZXZpZXc6aW5zZXJ0d2l0aGRyYXdSZXZpZXc6dXBkYXRlcXVlc3Rpb246bGlzdHdpdGhkcmF3UmV2aWV3OmRlbGV0ZXF1ZXN0aW9uOmZpbmRBbGxxdWVzdGlvbjpkZWxldGVtZXNzYWdlTGlzdDpsaXN0bWVzc2FnZUxpc3Q6ZmluZEFsbG1lc3NhZ2VMaXN0Omluc2VydG1lc3NhZ2VMaXN0OmRlbGV0ZXVzZXI6ZmluZHVzZXI6bGlzdHVzZXI6ZmluZERldGFpbHNCeUlkbGFuZGxvcmQ6bGlzdGxhbmRsb3JkOmZpbmRIb3VzZUluZm9CeUxhbmRsb3JkSWRsYW5kbG9yZDpmaW5kaG91c2VSZW50UmVxdWVzdDpsaXN0aG91c2VSZW50UmVxdWVzdDpmaW5kRGV0YWlsQnlJZGhvdXNlUmVudFJlcXVlc3Q6ZGVsZXRlZmFjaWxpdHk6bGlzdGZhY2lsaXR5OmZpbmRBbGxmYWNpbGl0eTppbnNlcnRmYWNpbGl0eTpkZWxldGVjb25maWd1cmF0aW9uOmZpbmRBbGxQYXltZW50Y29uZmlndXJhdGlvbjpmaW5kQWxsTGVhc2Vjb25maWd1cmF0aW9uOmZpbmRBbGxUb3dhcmRjb25maWd1cmF0aW9uOmZpbmRBbGxEZWNvcmF0ZWNvbnRyYWN0VGVtcGxhdGU6bGlzdGNvbnRyYWN0VGVtcGxhdGU6ZmluZEFsbGNvbnRyYWN0VGVtcGxhdGU6aW5zZXJ0Y29udHJhY3RUZW1wbGF0ZTpkZWxldGVjb250cmFjdFRlbXBsYXRlOmRlbGV0ZWNvbnRyYWN0VGVtcGxhdGU6ZmluZEJ5SWRob3VzZVJlcXVlc3Q6bGlzdGhvdXNlUmVxdWVzdDpkZWxldGUifQ.92u_QajKKM4EDeK-7bA2lTFR_9NhAcrgzm-AF1n-JX4'
          // },
          data: {},
        }).then((res) => {
          this.TableData = res.data;
          /**时间戳转换 */
          for (let i = 0; i < this.TableData.length; i++) {
            this.date = new Date(this.TableData[i].publishDate);
            this.Y = this.date.getFullYear() + "-";
            this.M =
              (this.date.getMonth() + 1 < 10
                ? "0" + (this.date.getMonth() + 1)
                : this.date.getMonth() + 1) + "-";
            this.D = this.date.getDate() + " ";
            this.h = this.date.getHours() + ":";
            this.m = this.date.getMinutes() + ":";
            this.s = this.date.getSeconds();
            this.TableData[i].publishDate =
              this.Y + this.M + this.D + this.h + this.m + this.s;
          }
          // console.log(this.TableData);
          this.AFaqTableData(this.TableData);
        });
      });
    },
    /**页码 */
    //  handleSizeChange(val) {
    //   console.log(`每页 ${val} 条`);

    // },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.$axios({
        method: "get",
        url: "/question/list",
        // headers:{
        //   token:'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwaG9uZSI6IjEzMjU4MjkwMDAwIiwibmFtZSI6IueuoeeQhuWRmCIsImlkZW50aXR5Q2FyZCI6IjUxMDkwMjE5OTkwNDMwODg4OCIsImV4cCI6MTY1ODgzODE0NCwidXNlcm5hbWUiOiJhZG1pbjExIiwicGVybWlzc2lvblRhZ3MiOiJiaWxsTWFuYWdlcjpsaXN0YmlsbE1hbmFnZXI6ZmluZEFsbGJpbGxNYW5hZ2VyOmZpbmRiaWxsTWFuYWdlcjppbnNlcnRiaWxsTWFuYWdlcjp1cGRhdGViaWxsTWFuYWdlcjpkZWxldGVob3VzZUluZm86bGlzdGhvdXNlSW5mbzp1cGRhdGVob3VzZUluZm86aW5zZXJ0aG91c2VJbmZvOmRlbGV0ZWhvdXNlSW5mbzpmaW5kRGV0YWlsY29udHJhY3RNYW5hZ2VyOmxpc3Rjb250cmFjdE1hbmFnZXI6ZmluZEFsbGNvbnRyYWN0TWFuYWdlcjpmaW5kY29udHJhY3RNYW5hZ2VyOmluc2VydGNvbnRyYWN0TWFuYWdlcjp1cGRhdGVjb250cmFjdE1hbmFnZXI6ZGVsZXRld2l0aGRyYXdSZXZpZXc6bGlzdHdpdGhkcmF3UmV2aWV3OmZpbmRBbGx3aXRoZHJhd1JldmlldzpmaW5kd2l0aGRyYXdSZXZpZXc6aW5zZXJ0d2l0aGRyYXdSZXZpZXc6dXBkYXRlcXVlc3Rpb246bGlzdHdpdGhkcmF3UmV2aWV3OmRlbGV0ZXF1ZXN0aW9uOmZpbmRBbGxxdWVzdGlvbjpkZWxldGVtZXNzYWdlTGlzdDpsaXN0bWVzc2FnZUxpc3Q6ZmluZEFsbG1lc3NhZ2VMaXN0Omluc2VydG1lc3NhZ2VMaXN0OmRlbGV0ZXVzZXI6ZmluZHVzZXI6bGlzdHVzZXI6ZmluZERldGFpbHNCeUlkbGFuZGxvcmQ6bGlzdGxhbmRsb3JkOmZpbmRIb3VzZUluZm9CeUxhbmRsb3JkSWRsYW5kbG9yZDpmaW5kaG91c2VSZW50UmVxdWVzdDpsaXN0aG91c2VSZW50UmVxdWVzdDpmaW5kRGV0YWlsQnlJZGhvdXNlUmVudFJlcXVlc3Q6ZGVsZXRlZmFjaWxpdHk6bGlzdGZhY2lsaXR5OmZpbmRBbGxmYWNpbGl0eTppbnNlcnRmYWNpbGl0eTpkZWxldGVjb25maWd1cmF0aW9uOmZpbmRBbGxQYXltZW50Y29uZmlndXJhdGlvbjpmaW5kQWxsTGVhc2Vjb25maWd1cmF0aW9uOmZpbmRBbGxUb3dhcmRjb25maWd1cmF0aW9uOmZpbmRBbGxEZWNvcmF0ZWNvbnRyYWN0VGVtcGxhdGU6bGlzdGNvbnRyYWN0VGVtcGxhdGU6ZmluZEFsbGNvbnRyYWN0VGVtcGxhdGU6aW5zZXJ0Y29udHJhY3RUZW1wbGF0ZTpkZWxldGVjb250cmFjdFRlbXBsYXRlOmRlbGV0ZWNvbnRyYWN0VGVtcGxhdGU6ZmluZEJ5SWRob3VzZVJlcXVlc3Q6bGlzdGhvdXNlUmVxdWVzdDpkZWxldGUifQ.92u_QajKKM4EDeK-7bA2lTFR_9NhAcrgzm-AF1n-JX4'
        // },
        params: {
          page: val,
          limit: this.pageSize,
        },
      }).then((res) => {
        this.TableData = res.data;
        /**时间戳转换 */
        for (let i = 0; i < this.TableData.length; i++) {
          this.date = new Date(this.TableData[i].publishDate);
          this.Y = this.date.getFullYear() + "-";
          this.M =
            (this.date.getMonth() + 1 < 10
              ? "0" + (this.date.getMonth() + 1)
              : this.date.getMonth() + 1) + "-";
          this.D = this.date.getDate() + " ";
          this.h = this.date.getHours() + ":";
          this.m = this.date.getMinutes() + ":";
          this.s = this.date.getSeconds();
          this.TableData[i].publishDate =
            this.Y + this.M + this.D + this.h + this.m + this.s;
        }
        // console.log(this.TableData);
        this.AFaqTableData(this.TableData);
      });
    },
  },
};
</script>
<style lang='less' scoped>
.el-pagination {
  font-weight: normal;
  float: right;
  margin-top: 20px;
}
.el-button {
  width: auto !important;
}
</style>